﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using IBatisNet.DataMapper.Configuration;
using IBatisNet.DataMapper;
using MvcDeviceManager.Models;
using MvcDeviceManager.Util;

namespace MvcDeviceManager.Service
{
    
    public class MenuActionService
    {

        public IList<MenuAction> allMenuAction()
        {
            return DaoUtil.getSqlMapper().QueryForList<MenuAction>("selectAll", null);
        }

        public IList<MenuAction> listMenuActionByRoleAuthority(IList<RoleAuthority> roleAuthoritys)
        {
            IList<MenuAction> list = new List<MenuAction>(roleAuthoritys.Count);
            foreach (RoleAuthority ra in roleAuthoritys)
            {
                list.Add(DaoUtil.getSqlMapper().QueryForObject<MenuAction>("selectMenuActionByControllerAndActionId", ra));
            }
            return list;
        }
    }
}